import request from '@/common/request';
import config from '@/common/config';

export function sendgetRestaurant() {
  const result = request({
    url: `${config.server}/restaurant/location/-74.0059413,40.7127837`,
    method: 'get',
  });
  return result;
}

// 发送请求改变 isClosed 的值
export function sendgetClosed({ id, closed }) {
  const result = request({
    url: `${config.server}/restaurant`,
    method: 'post',
    data: {
      id,
      data: {
        closed,
      },
    },
  });
  return result;
}

// 发送请求, 获取tags
export function sendgetTags() {
  const result = request({
    url: `${config.server}/tags`,
    method: 'get',
  });
  return result;
}

//* 发送请求，修改数据库的商店的信息
export function sendUpdateRest({
  id: shopID, name: shopName, tags: shopTags, hours,
}) {
  const result = request({
    url: `${config.server}/restaurant`,
    method: 'post',
    data: {
      id: shopID,
      data: { name: shopName, tags: shopTags, hours },
    },
  });
  return result;
}
